<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <ul>
      <li>妲己</li>
      <li>鲁班</li>
      <li>亚瑟</li>
      <li>蔡文姬</li>
    </ul>
    <script>
      let lis = document.querySelectorAll("ul li");
      for (let i = 0; i < lis.length; i++) {
        lis[i].addEventListener("click", function (e) {
          alert(this.innerText);
        });
      }
    </script>
  </body>
</html>
